import Vue from 'vue'
import VueRouter from 'vue-router'
import Reg from "@/views/Reg/Reg"
import Login from "@/views/Login/Login"
import Main from "@/views/Main/Main.vue"
import Home from '@/views/Menus/Home/Home.vue'
import UserInfo from '@/views/Menus/User/UserInfo.vue'
import UserAvatar from '@/views/Menus/User/UserAvatar.vue'
import UserPwd from '@/views/Menus/User/UserPwd.vue'
import ArtCate from '@/views/Menus/Article/ArtCate.vue'
import ArtList from '@/views/Menus/Article/ArtList.vue'
Vue.use(VueRouter)

const routes = [{
    path: "/reg",
    component: Reg
  }, {
    path: "/login",
    component: Login
  },
  {
    path: "/",
    component: Main,
    redirect: '/home',
    children: [
      // 2. home 作为 子路由规则
      {
        path: 'home',
        component: Home
      },
      {
        path: 'user-info',
        component: UserInfo
      },
      {
        path: 'user-avatar',
        component: UserAvatar
      },
      {
        path: 'user-pwd',
        component: UserPwd
      },
      {
        path: 'art-cate',
        component: ArtCate
      },
      {
        path: 'art-list',
        component: ArtList
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
